import http from "@/utils/http";

//获取国家分页列表
export const getCountryList = (
  data = {
    pageIndex: 1,
    pageSize: 50,
    sortField: "countryId",
    sortOrder: "desc",
    name: "",
  }
) =>
  http({
    url: "/api/country/getbypage",
    method: "get",
    query: data,
  });

//上移下移国家
export const moveCountry = (data: any) =>
  http({
    url: "/api/country/move",
    method: "post",
    data,
  });

//更新国家状态
export const updateCountry = (data: { countryId: number; isActive: boolean }) =>
  http({
    url: `/api/country/update/${data.countryId}`,
    method: "put",
    data: {
      isActive: data.isActive,
    },
  });

//新增国家
export const AddCountry = (data: any) =>
  http({
    url: "/api/country/create",
    method: "post",
    data,
  });

//获取有效国家列表
export const getEffectiveCountry = () =>
  http({
    url: "/api/country/getlist",
    method: "get",
  });
